package com.tb.mapper;

import com.tb.DTO.userDTO;
import com.tb.entity.user;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface UserMapper {
    // 用户登录方法

    @Select("select * from user where username=#{username}")
    user userByUsername(String username);

    // 用户注册
    @Insert("insert into user(username,password) values (#{username},#{password})")
    void register(userDTO userDTO);

    // 修改密码
    @Update("update user set password=#{newPassword} where username=#{username}")
    void resetPassword(@Param("newPassword") String newPassword, @Param("username") String username);

    @Select("select * from user where id = #{id}")
    user getById(Long id);

    @Select("select * from user")
    List<user> getUserList();
}
